<?php
/**
 *============================================================================
 * Cornice PHP Framework & Website Builder
 * Freeware (f) 2011 by Inforo Software & Computer
 *============================================================================
 */
 
/**
 * Class processing HTTP response
 * @author Nicola Dinh
 * @version 2011.04.2217
 */
class response {

  /**
   * Default instance level constructor
   * Just decorative, should not be called due to having only static methods
   */
  public function __construct() {
    //
  }
  
  /**
   * Dump object to browser within 'pre' tags
   * @param string $object The object to dump to browser
   */
  public static function dump($object) {
    echo "<pre style='text-align:left;'>";
    var_dump($object);
    echo "</pre>";
  }
  
  /**
   * Print an error message
   * @param string $error_msg The error message
   */
  public static function error($error_msg) {  
    print_error($error_msg);
  }
  
  /** 
   * Redirect to some URL, all data in POST & GET will be lost
   * @param string $url The relative or absolute URl to redirect to
   */
  public static function redirect_to($url) {
    system::break_all_buffers();
    $url = str_replace("\"","",$url);
    echo("
      <script>
      top.location = \"$url\";
      </script>
    ");
    exit;
  }
}